#include "student.h"
#include <cstring>
#include <iostream>

Student::Student(int id, const std::string &name) : id(id), name(name) {}

void Student::Free(ElementType element)
{
    Student *s = (Student *)element;
    delete s;
    // delete (Student *)element;
}

void Student::Print(ElementType element)
{
    Student *s = (Student *)element;
    std::cout << "学生学号" << s->id << " " << "学生姓名" << s->name << std::endl;
}

int Student::Compr(ElementType element1, ElementType element2)
{
    Student *s1 = (Student *)element1;
    Student *s2 = (Student *)element2;
    return s1->id - s2->id;
    // return s1->name.compare(s2->name);
}

bool Student::AllCompr(ElementType element1, ElementType element2)
{
    Student *s1 = (Student *)element1;
    Student *s2 = (Student *)element2;
    return s1->name == s2->name && s1->id == s2->id;
}
